package syan.label.common;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 汉印打印传输模型
 *
 * @author <a href="mailto:xiongliyi@hichain.com">Ian Xiong</a>
 * @since 3.3.5
 */
@NoArgsConstructor
@Data
public class HprtPrintVO {


    /**
     * 纸张高度（单位：mm）
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer height = 1;
    /**
     * 纸张宽度（单位：mm）
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer pageWidth = 1;
    /**
     * 偏移量
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer offset;
    /**
     * 水平方向
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer horizontal;
    /**
     * 垂直方向
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer vertical;
    /**
     * 终端类型
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String clientType;
    /**
     * 数量
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer qty;
    /**
     * 打印机型号
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String edition = EditionTypeEnum.N41BT.name;
    /**
     * 字体加粗
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean bold = Boolean.FALSE;
    /**
     * 打印内容
     */
    private List<HprtPrintItemVO> printPageDatas;

    /**
     * @param offset     偏移量
     * @param pageHeight 纸张高度 （mm）
     * @param pageWidth  纸张宽度（mm）
     * @param qty        打印张数（份）
     * @param horizontal 水平方向
     * @param vertical   垂直方向
     */
    public HprtPrintVO(Integer offset, Integer pageHeight, Integer pageWidth, Integer qty, Integer horizontal, Integer vertical) {
        this.height = pageHeight;
        this.pageWidth = pageWidth;
        this.offset = offset;
        this.qty = qty;
        this.horizontal = horizontal;
        this.vertical = vertical;
    }

    public HprtPrintVO(Integer offset, Integer pageHeight, Integer pageWidth, Integer qty) {
        this(offset, pageHeight, pageWidth, qty, 0, 0);
    }

    public String getOffset() {
        return String.valueOf(offset);
    }

    public String getHorizontal() {
        return String.valueOf(horizontal);
    }

    public String getVertical() {
        return String.valueOf(vertical);
    }

    public String getHeight() {
        return String.valueOf(height);
    }

    public String getPageWidth() {
        return String.valueOf(pageWidth);
    }

    public String getQty() {
        return String.valueOf(qty);
    }

    public String getBold() {
        return bold ? "1" : "0";
    }

    @AllArgsConstructor
    public enum EditionTypeEnum {
        N41BT("N41BT"),
        BM("BM"),
        HPRT_N41("HPRT_N41");
        private final String name;
    }
}
